package collection;

import java.util.ArrayList;
import java.util.Collection;
import java.util.Iterator;

public class NewForDemo {
    public static void main(String[] args) {

        String[] array = {"one","two","three","four"};

        Collection<String> c1 = new ArrayList<>();
        c1.add("苹果");
        c1.add("芒果");
        c1.add("梨子");
        c1.add("香蕉");
        //c1.add(12345);

        Iterator <String>it = c1.iterator();
        while (it.hasNext()){
            String str = it.next();
            System.out.println(str);
        }

        for (int i = 0; i < array.length; i++) {
            String str = array[i];
            System.out.println(str);
        }


        System.out.println("==========================");

        for (String str :
                array) {
            System.out.println(str);
        }

        for (String str :
                c1) {
            System.out.println(str);
        }

    }
}
